<?php
/**
 * RedCross Application
 *
 * @copyright Copyright (c) 2010, Kristian Stokke Tryggestad, Rune Vikestad, Andreas Flaten Wist, Simen Nicolai Echholt, Ole Henrik Jahren
 */

/**
 * Service for the roles
 *
 * @category
 * @package Core_Service
 */
class Core_Service_Role extends RedCross_Service_ServiceAbstract
{
	public function __construct(Core_Gateway_Role $gateway)
	{
		parent::__construct($gateway, 'Core_Model_Role');
	}

	public function fetchByTemplateId($id)
	{
		if (!is_int($id)) {
			throw new RedCross_Service_Exception('The given argument should be an integer');
		}
		return $this->_gateway->fetchByTemplateId($id);
	}
	
	public function fetchByShiftId($eventId)
	{
		if (!is_int($eventId)) {
			throw new RedCross_Service_Exception('The given argument should be an integer');
		}
		return $this->getGateway()->fetchByShiftId($eventId);
	}
	
	public function fetchAllSorted()
	{
		return $this->getGateway()->fetchAllSorted();
	}
}